package top.go2do.websiteNavigation.business.website.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import top.go2do.websiteNavigation.business.website.module.WebsiteTagPO;

import java.util.List;
import java.util.Set;

/**
 * @Description
 * @Author xingyj
 * @CreateTime 2025/3/17 10:21
 */
public interface WebsiteTagRepository extends JpaRepository<WebsiteTagPO, Long>, JpaSpecificationExecutor<WebsiteTagPO> {
    List<WebsiteTagPO> findByWebsiteIdIn(Set<Long> websiteIdSet);
    List<WebsiteTagPO> findByTagIdIn(Set<Long> tagIdSet);


    @Transactional
    @Modifying
    @Query("DELETE FROM WebsiteTagPO wt WHERE wt.websiteId = ?1")
    int deleteByWebsiteId(Long websiteId);
}
